#!/bin/bash
ALLOWED_CYCLE_LEVEL=20

functions="$(dirname "$0")/env.sh"
if [ -f "$functions" ]; then
  # shellcheck disable=SC1090
  source "$functions"
fi

GO_MODULE_VERSION=$(go list -m -f '{{ .GoVersion }}')

gocyclo -over ${ALLOWED_CYCLE_LEVEL} cmd pkg
# golint ./cmd/... ./pkg/...
go vet ./...
#: go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -go ${GO_MODULE_VERSION} ./...
# https://github.com/client9/misspell
misspell -locale US .

if [ -f ./bin/${APP_NAME} ]; then
  echo -e "\nrunning govulncheck over the binary: ./bin/${APP_NAME}"
  govulncheck -mode=binary ./bin/${APP_NAME}
fi

